<?php

namespace App\Http\Service;

use App\Libs\HttpCurlLibrary;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Log;
use App\Models\Productcategoryparent;
use App\Models\Productcategory;
//爆料首页产品分类
class ProductcategoryparentService extends BaseService
{
   
    public function __construct(Productcategoryparent $model,Productcategory $productcategory)
    {
        parent::__construct();
        $this->model=$model;
        $this->productcategory=$productcategory;
    }

    public  function getList($request,$data=[])
    {
        $limit=$data['limit'];
        $fileds=['*'];
        if($limit){
            $list=$this->model->select($fileds)->limit($limit)->get()->toArray();
        }else{
            $list=$this->model->select($fileds)->get()->toArray();
        }
        
        return $list;
    }

    public  function getList2($request,$data=[])
    {
        $limit=$data['limit'];
        $fileds=['*'];
        $where=[
            'parent_id'=>$data['parent_id']
        ];
        if($limit){
            $list=$this->productcategory->where($where)->select($fileds)->limit($limit)->get()->toArray();
        }else{
            $list=$this->productcategory->where($where)->select($fileds)->get()->toArray();
        }
        
        return $list;
    }
    

}
